package com.ruowei.modules.foodOrder.domain;

import com.ruowei.modules.foodOrder.domain.enumeration.OrderStatus;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import javax.persistence.*;
import javax.validation.constraints.*;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.Instant;
import java.time.LocalDate;

/**
 * 订单表
 */
@ApiModel(description = "订单表")
@Entity
@Table(name = "jhi_order")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class Order implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    /**
     * 订单编码
     */
    @ApiModelProperty(value = "订单编码")
    @Column(name = "order_code")
    private String orderCode;

    /**
     * 生成时间
     */
    @ApiModelProperty(value = "生成时间")
    @Column(name = "create_time")
    private Instant createTime;

    /**
     * 生成日期
     */
    @ApiModelProperty(value = "生成日期")
    @Column(name = "create_date")
    private LocalDate createDate;

    /**
     * 用户编码
     */
    @ApiModelProperty(value = "用户编码")
    @Column(name = "member_code")
    private String memberCode;

    /**
     * 商家编码
     */
    @ApiModelProperty(value = "商家编码")
    @Column(name = "merchant_code")
    private String merchantCode;

    /**
     * 总金额
     */
    @ApiModelProperty(value = "总金额")
    @Column(name = "total_amount", precision = 21, scale = 2)
    private BigDecimal totalAmount;

    /**
     * 实付金额
     */
    @ApiModelProperty(value = "实付金额")
    @Column(name = "pay_amount", precision = 21, scale = 2)
    private BigDecimal payAmount;

    /**
     * 支付方式
     */
    @ApiModelProperty(value = "支付方式")
    @Column(name = "pay_type")
    private String payType;

    /**
     * 状态 待支付、待接单、商家已接单、配送员已接单、已送达、退款中、已退款、退款失败
     * 进行中：待接单、商家已接单、配送员已接单
     * 待支付
     * 退款：退款中、退款同意、已退款、退款失败、退款关闭
     * 已送达、已取消在全部
     */
    @ApiModelProperty(value = "待支付、待接单、商家已接单、配送员已接单、已送达、退款中、退款同意、已退款、退款失败、退款关闭、已取消")
    @Column(name = "status")
    @Enumerated(EnumType.STRING)
    private OrderStatus status;

    /**
     * 收货人姓名
     */
    @ApiModelProperty(value = "收货人姓名")
    @Column(name = "receiver_name")
    private String receiverName;

    /**
     * 收货人电话
     */
    @ApiModelProperty(value = "收货人电话")
    @Column(name = "receiver_phone")
    private String receiverPhone;

    /**
     * 收货人地址
     */
    @ApiModelProperty(value = "收货人地址")
    @Column(name = "receiver_address")
    private String receiverAddress;

    /**
     * 订单备注
     */
    @Size(max = 2000)
    @ApiModelProperty(value = "订单备注")
    @Column(name = "remark", length = 2000)
    private String remark;

    /**
     * 确认收货状态
     */
    @ApiModelProperty(value = "确认收货状态")
    @Column(name = "confirm_status")
    private Boolean confirmStatus;

    /**
     * 删除状态
     */
    @ApiModelProperty(value = "删除状态")
    @Column(name = "delete_status")
    private Boolean deleteStatus;

    /**
     * 使用的积分数
     */
    @ApiModelProperty(value = "使用的积分数")
    @Column(name = "use_point")
    private Integer usePoint;

    /**
     * 支付时间
     */
    @ApiModelProperty(value = "支付时间")
    @Column(name = "payment_time")
    private Instant paymentTime;

    /**
     * 商家接单时间
     */
    @ApiModelProperty(value = "商家接单时间")
    @Column(name = "merchant_receive_time")
    private Instant merchantReceiveTime;

    /**
     * 配送员接单时间
     */
    @ApiModelProperty(value = "配送员接单时间")
    @Column(name = "courier_receive_time")
    private Instant courierReceiveTime;

    /**
     * 送出时间
     */
    @ApiModelProperty(value = "送出时间")
    @Column(name = "delivery_time")
    private Instant deliveryTime;

    /**
     * 送达时间
     */
    @ApiModelProperty(value = "送达时间")
    @Column(name = "receive_time")
    private Instant receiveTime;

    /**
     * 评价时间
     */
    @ApiModelProperty(value = "评价时间")
    @Column(name = "comment_time")
    private Instant commentTime;

    /**
     * 更新时间
     */
    @ApiModelProperty(value = "更新时间")
    @Column(name = "update_time")
    private Instant updateTime;

    /**
     * 配送员编码
     */
    @ApiModelProperty(value = "配送员编码")
    @Column(name = "courier_code")
    private String courierCode;

    /**
     * 配送员姓名
     */
    @ApiModelProperty(value = "配送员姓名")
    @Column(name = "courier_name")
    private String courierName;

    /**
     * 配送员电话
     */
    @ApiModelProperty(value = "配送员电话")
    @Column(name = "courier_phone")
    private String courierPhone;

    // jhipster-needle-entity-add-field - JHipster will add fields here, do not remove
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getMerchantCode() {
        return merchantCode;
    }

    public void setMerchantCode(String merchantCode) {
        this.merchantCode = merchantCode;
    }

    public String getOrderCode() {
        return orderCode;
    }

    public Order orderCode(String orderCode) {
        this.orderCode = orderCode;
        return this;
    }

    public void setOrderCode(String orderCode) {
        this.orderCode = orderCode;
    }

    public Instant getCreateTime() {
        return createTime;
    }

    public Order createTime(Instant createTime) {
        this.createTime = createTime;
        return this;
    }

    public void setCreateTime(Instant createTime) {
        this.createTime = createTime;
    }

    public LocalDate getCreateDate() {
        return createDate;
    }

    public Order createDate(LocalDate createDate) {
        this.createDate = createDate;
        return this;
    }

    public void setCreateDate(LocalDate createDate) {
        this.createDate = createDate;
    }

    public Instant getMerchantReceiveTime() {
        return merchantReceiveTime;
    }

    public void setMerchantReceiveTime(Instant merchantReceiveTime) {
        this.merchantReceiveTime = merchantReceiveTime;
    }

    public Instant getCourierReceiveTime() {
        return courierReceiveTime;
    }

    public void setCourierReceiveTime(Instant courierReceiveTime) {
        this.courierReceiveTime = courierReceiveTime;
    }

    public String getMemberCode() {
        return memberCode;
    }

    public Order memberCode(String memberCode) {
        this.memberCode = memberCode;
        return this;
    }

    public void setMemberCode(String memberCode) {
        this.memberCode = memberCode;
    }

    public BigDecimal getTotalAmount() {
        return totalAmount;
    }

    public Order totalAmount(BigDecimal totalAmount) {
        this.totalAmount = totalAmount;
        return this;
    }

    public void setTotalAmount(BigDecimal totalAmount) {
        this.totalAmount = totalAmount;
    }

    public BigDecimal getPayAmount() {
        return payAmount;
    }

    public Order payAmount(BigDecimal payAmount) {
        this.payAmount = payAmount;
        return this;
    }

    public void setPayAmount(BigDecimal payAmount) {
        this.payAmount = payAmount;
    }

    public String getPayType() {
        return payType;
    }

    public Order payType(String payType) {
        this.payType = payType;
        return this;
    }

    public void setPayType(String payType) {
        this.payType = payType;
    }

    public OrderStatus getStatus() {
        return status;
    }

    public Order status(OrderStatus status) {
        this.status = status;
        return this;
    }

    public void setStatus(OrderStatus status) {
        this.status = status;
    }

    public String getReceiverName() {
        return receiverName;
    }

    public Order receiverName(String receiverName) {
        this.receiverName = receiverName;
        return this;
    }

    public void setReceiverName(String receiverName) {
        this.receiverName = receiverName;
    }

    public String getReceiverPhone() {
        return receiverPhone;
    }

    public Order receiverPhone(String receiverPhone) {
        this.receiverPhone = receiverPhone;
        return this;
    }

    public void setReceiverPhone(String receiverPhone) {
        this.receiverPhone = receiverPhone;
    }

    @Override
    public String toString() {
        return "Order{" +
            "id=" + id +
            ", orderCode='" + orderCode + '\'' +
            ", createTime=" + createTime +
            ", createDate=" + createDate +
            ", memberCode='" + memberCode + '\'' +
            ", totalAmount=" + totalAmount +
            ", payAmount=" + payAmount +
            ", payType='" + payType + '\'' +
            ", status='" + status + '\'' +
            ", receiverName='" + receiverName + '\'' +
            ", receiverPhone='" + receiverPhone + '\'' +
            ", receiverAddress='" + receiverAddress + '\'' +
            ", remark='" + remark + '\'' +
            ", confirmStatus=" + confirmStatus +
            ", deleteStatus=" + deleteStatus +
            ", usePoint=" + usePoint +
            ", paymentTime=" + paymentTime +
            ", merchantReceiveTime=" + merchantReceiveTime +
            ", courierReceiveTime=" + courierReceiveTime +
            ", deliveryTime=" + deliveryTime +
            ", receiveTime=" + receiveTime +
            ", commentTime=" + commentTime +
            ", updateTime=" + updateTime +
            ", courierCode='" + courierCode + '\'' +
            ", courierName='" + courierName + '\'' +
            ", courierPhone='" + courierPhone + '\'' +
            '}';
    }

    public Order receiverAddress(String receiverAddress) {
        this.receiverAddress = receiverAddress;
        return this;
    }

    public String getReceiverAddress() {
        return receiverAddress;
    }

    public void setReceiverAddress(String receiverAddress) {
        this.receiverAddress = receiverAddress;
    }

    public String getRemark() {
        return remark;
    }

    public Order remark(String remark) {
        this.remark = remark;
        return this;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public Boolean isConfirmStatus() {
        return confirmStatus;
    }

    public Order confirmStatus(Boolean confirmStatus) {
        this.confirmStatus = confirmStatus;
        return this;
    }

    public void setConfirmStatus(Boolean confirmStatus) {
        this.confirmStatus = confirmStatus;
    }

    public Boolean isDeleteStatus() {
        return deleteStatus;
    }

    public Order deleteStatus(Boolean deleteStatus) {
        this.deleteStatus = deleteStatus;
        return this;
    }

    public void setDeleteStatus(Boolean deleteStatus) {
        this.deleteStatus = deleteStatus;
    }

    public Integer getUsePoint() {
        return usePoint;
    }

    public Order usePoint(Integer usePoint) {
        this.usePoint = usePoint;
        return this;
    }

    public void setUsePoint(Integer usePoint) {
        this.usePoint = usePoint;
    }

    public Instant getPaymentTime() {
        return paymentTime;
    }

    public Order paymentTime(Instant paymentTime) {
        this.paymentTime = paymentTime;
        return this;
    }

    public void setPaymentTime(Instant paymentTime) {
        this.paymentTime = paymentTime;
    }

    public Instant getDeliveryTime() {
        return deliveryTime;
    }

    public Order deliveryTime(Instant deliveryTime) {
        this.deliveryTime = deliveryTime;
        return this;
    }

    public void setDeliveryTime(Instant deliveryTime) {
        this.deliveryTime = deliveryTime;
    }

    public Instant getReceiveTime() {
        return receiveTime;
    }

    public Order receiveTime(Instant receiveTime) {
        this.receiveTime = receiveTime;
        return this;
    }

    public void setReceiveTime(Instant receiveTime) {
        this.receiveTime = receiveTime;
    }

    public Instant getCommentTime() {
        return commentTime;
    }

    public Order commentTime(Instant commentTime) {
        this.commentTime = commentTime;
        return this;
    }

    public void setCommentTime(Instant commentTime) {
        this.commentTime = commentTime;
    }

    public Instant getUpdateTime() {
        return updateTime;
    }

    public Order updateTime(Instant updateTime) {
        this.updateTime = updateTime;
        return this;
    }

    public void setUpdateTime(Instant updateTime) {
        this.updateTime = updateTime;
    }

    public String getCourierCode() {
        return courierCode;
    }

    public Order courierCode(String courierCode) {
        this.courierCode = courierCode;
        return this;
    }

    public void setCourierCode(String courierCode) {
        this.courierCode = courierCode;
    }

    public String getCourierName() {
        return courierName;
    }

    public Order courierName(String courierName) {
        this.courierName = courierName;
        return this;
    }

    public void setCourierName(String courierName) {
        this.courierName = courierName;
    }

    public String getCourierPhone() {
        return courierPhone;
    }

    public Order courierPhone(String courierPhone) {
        this.courierPhone = courierPhone;
        return this;
    }

    public void setCourierPhone(String courierPhone) {
        this.courierPhone = courierPhone;
    }
    // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof Order)) {
            return false;
        }
        return id != null && id.equals(((Order) o).id);
    }

    @Override
    public int hashCode() {
        return 31;
    }

}
